package com.soso.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.soso.entity.Modules;
import com.soso.entity.Users;

public interface ModulesDao extends JpaRepository<Modules, Integer>,JpaSpecificationExecutor<Modules> {

	@Query(value = "select * from modules where Id in (select ModuleId from rolemodules where RoleId in(select RoleId from userroles where UserId=?1))",nativeQuery = true)
	public List<Modules> getmodall(String UserId);
	
	@Query(value = "select * from modules where Id in (select ModuleId from rolemodules where RoleId=?1)",nativeQuery = true)
	public List<Modules> getmodalls(String RoleId);
	
	@Query(value="select * from modules where Id=?1",nativeQuery = true)
	 public Modules Modulesgetallss(Integer Id);
	
}
